package com.bw.mapper;

import com.bw.bean.Vo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Mapper
public interface VoMapper {
    //查询订单的总价格，实现翻牌器大屏展示
    @Select("select sum(price) from orderinfo")
    Double a();

    //查询各货物的销售总额的占比，编写正确sql的语句
    @Select("select c.cargo_name `name`,\n" +
            "       sum(o.price) `value`\n" +
            "from cargo c\n" +
            "left join orderinfo o on c.order_id = o.order_id\n" +
            "group by c.cargo_name")
    List<Vo> b();

    //查询各省份的销售总额，编写正确sql的语句
    @Select("select b.name `name`,\n" +
            "       sum(o.price) `value`\n" +
            "from baseprovince b\n" +
            "left join orderinfo o on b.id = o.province_id\n" +
            "group by b.name")
    List<Vo> c();
}
